<template>
  <div>
    <el-form :inline="true" :model="form" class="demo-form-inline">
      <el-form-item label="用户电话">
        <el-input v-model="form.phone" placeholder="请输入用户电话" clearable maxlength="11"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-plus" @click="createUser">添加</el-button>
      </el-form-item>
    </el-form>
    <forms :is_edit="false" :cur_this="cur_this" ref="createform"></forms>
  </div>
</template>

<script>
import forms from "./form";
import * as MDZZ from "@/http/reg";
export default {
  components: { forms },
  props: {
    cur_this: {
      type: Object,
      required: null
    }
  },
  data() {
    return {
      form: {
        phone: ""
      }
    };
  },
  methods: {
     search(){
      if(MDZZ.shoujihao(this.form.phone)){
        this.cur_this.getList(this.form)
      }else{
         this.$message({
          message: "请输入正确的手机号",
          type: "warning"
        });
      }
    },
    createUser() {
      const _this = this.$refs.createform;
      _this.domInit('');
    }
  }
};
</script>

<style lang="scss">
</style>
